package com.src;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.src.R;

public class TranslateLayout  extends Activity implements OnClickListener {  
  
    RelativeLayout layout1;  
  
    String tag;  
  
    /** Called when the activity is first created. */  
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.first);  
        ImageView first_btn = (ImageView) findViewById(R.id.first_btn);  
        first_btn.setOnClickListener(this);  
  
        layout1 = (RelativeLayout) findViewById(R.id.layout1);  
        showView();  
  
    }  
  
    public void showView() {  
        /* ȡ��Intent�е�Bundle���� */  
        Bundle bundle = this.getIntent().getExtras();  
  
        if (bundle != null) {  
            /* ȡ��Bundle�����е���� */  
            tag = bundle.getString("second");  
            System.out.println("tag =" + tag);  
            if (tag.equals("Second")) {  
                rotateHelper = new RotationHelper(this,  
                        Constants.KEY_FIRST_CLOCKWISE);  
                rotateHelper.applyLastRotation(layout1, -90, 0);  
            }  
        }  
    }  
  
    RotationHelper rotateHelper;  
  
    @Override  
    public void onClick(View v) {  
        // TODO Auto-generated method stub  
        rotateHelper = new RotationHelper(this, Constants.KEY_FIRST_INVERSE);  
        rotateHelper.applyFirstRotation(layout1, 0, -90);  
    }  
  
    public void jumpToSecond() {  
        Intent in = new Intent();  
        in.setClass(this, Second.class);  
        // newһ��Bundle���󣬲���Ҫ���ݵ���ݴ���  
        Bundle bundle = new Bundle();  
        bundle.putString("front", "First");  
        /* ��Bundle����assign��Intent */  
        in.putExtras(bundle);  
        // ����Ѿ��򿪹��ʵ��������´��µ�Activity  
        // in.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);  
        startActivity(in);  
        finish();  
    }  
  
}  